package sctu.edu.java.year2016.team05.lizixin.day20160613.chapter10_3;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * Created by home on 2016/6/13.
 * 创建Map集合，创建Emp对象，并将创建的Emp对象添加到集合中（Emp对象的id作为Map集合的键），并将id为005的对象从集合中移除
 */

public class Test {
    public static void main(String[] args) {
        Map<String, String> map = new HashMap<String, String>();
        Emp emp = new Emp("001", "张三");
        Emp emp1 = new Emp("002", "李四");
        Emp emp2 = new Emp("003", "王麻子");
        Emp emp3 = new Emp("004", "王小二");
        Emp emp4 = new Emp("005", "小明");
        Emp emp5 = new Emp("006", "二狗子");
        map.put(emp.getId(), emp.getName());
        map.put(emp1.getId(), emp1.getName());
        map.put(emp2.getId(), emp2.getName());
        map.put(emp3.getId(), emp3.getName());
        map.put(emp4.getId(), emp4.getName());
        map.put(emp5.getId(), emp5.getName());
        System.out.println("移除数据前" + map);
        map.remove("005");
        System.out.println("移除数据后" + map);


    }
}

class Emp {
    private String id;
    private String name;

    public Emp(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public String getName() {
        return name;
    }

}